package jisuanji;

import java.awt.geom.Ellipse2D;
import java.awt.Shape;

public class Circle extends MyShape {
    private double r;
    
    public Circle(double r) {
        super("圆形");
        this.r = r;
    }
    
    @Override
    public double getArea() {
        return Math.PI * r * r;
    }
    
    @Override
    public double getPerimeter() {
        return 2 * Math.PI * r;
    }
    
    @Override
    public Shape getRealShape() {
        return new Ellipse2D.Double(-r, -r, 2 * r, 2 * r);
    }
}